home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / aflex.vim < prev    next >
Encoding:
Text File  |  2001-09-02  |  4.7 KB  |  102 lines

  1.  
  2. " Vim syntax file
  3. " Language:    AfLex (from Lex syntax file)
  4. " Maintainer:    Mathieu Clabaut <mathieu.clabaut@free.fr>
  5. " LastChange:    02 May 2001
  6. " Original:    Lex, maintained by Dr. Charles E. Campbell, Jr.
  7. "                <Charles.Campbell@gsfc.nasa.gov>
  8. " Comment:    Replaced sourcing c.vim file by ada.vim and rename lex*
  9. "        in aflex*
  10.  
  11. " For version 5.x: Clear all syntax items
  12. " For version 6.x: Quit when a syntax file was already loaded
  13. if version < 600
  14.    syntax clear
  15. elseif exists("b:current_syntax")
  16.    finish
  17. endif
  18.  
  19. " Read the Ada syntax to start with
  20. if version < 600
  21.    so <sfile>:p:h/ada.vim
  22. else
  23.    runtime! syntax/ada.vim
  24.    unlet b:current_syntax
  25. endif
  26.  
  27.  
  28. " --- AfLex stuff ---
  29.  
  30. "I'd prefer to use aflex.* , but it doesn't handle forward definitions yet
  31. syn cluster aflexListGroup        contains=aflexAbbrvBlock,aflexAbbrv,aflexAbbrv,aflexAbbrvRegExp,aflexInclude,aflexPatBlock,aflexPat,aflexBrace,aflexPatString,aflexPatTag,aflexPatTag,aflexPatComment,aflexPatCodeLine,aflexMorePat,aflexPatSep,aflexSlashQuote,aflexPatCode,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2
  32. syn cluster aflexListPatCodeGroup    contains=aflexAbbrvBlock,aflexAbbrv,aflexAbbrv,aflexAbbrvRegExp,aflexInclude,aflexPatBlock,aflexPat,aflexBrace,aflexPatTag,aflexPatTag,aflexPatComment,aflexPatCodeLine,aflexMorePat,aflexPatSep,aflexSlashQuote,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2
  33.  
  34. " Abbreviations Section
  35. syn region aflexAbbrvBlock    start="^\([a-zA-Z_]\+\t\|%{\)" end="^%%$"me=e-2    skipnl    nextgroup=aflexPatBlock contains=aflexAbbrv,aflexInclude,aflexAbbrvComment
  36. syn match  aflexAbbrv        "^\I\i*\s"me=e-1            skipwhite    contained nextgroup=aflexAbbrvRegExp
  37. syn match  aflexAbbrv        "^%[sx]"                    contained
  38. syn match  aflexAbbrvRegExp    "\s\S.*$"lc=1                contained nextgroup=aflexAbbrv,aflexInclude
  39. syn region aflexInclude    matchgroup=aflexSep    start="^%{" end="%}"    contained    contains=ALLBUT,@aflexListGroup
  40. syn region aflexAbbrvComment    start="^\s\+/\*"    end="\*/"
  41.  
  42. "%% : Patterns {Actions}
  43. syn region aflexPatBlock    matchgroup=Todo    start="^%%$" matchgroup=Todo end="^%%$"    skipnl skipwhite contains=aflexPat,aflexPatTag,aflexPatComment
  44. syn region aflexPat        start=+\S+ skip="\\\\\|\\."    end="\s"me=e-1    contained nextgroup=aflexMorePat,aflexPatSep contains=aflexPatString,aflexSlashQuote,aflexBrace
  45. syn region aflexBrace    start="\[" skip=+\\\\\|\\+        end="]"        contained
  46. syn region aflexPatString    matchgroup=String start=+"+    skip=+\\\\\|\\"+    matchgroup=String end=+"+    contained
  47. syn match  aflexPatTag    "^<\I\i*\(,\I\i*\)*>*"            contained nextgroup=aflexPat,aflexPatTag,aflexMorePat,aflexPatSep
  48. syn match  aflexPatTag    +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+        contained nextgroup=aflexPat,aflexPatTag,aflexMorePat,aflexPatSep
  49. syn region aflexPatComment    start="^\s*/\*" end="\*/"        skipnl    contained contains=cTodo nextgroup=aflexPatComment,aflexPat,aflexPatString,aflexPatTag
  50. syn match  aflexPatCodeLine    ".*$"                    contained contains=ALLBUT,@aflexListGroup
  51. syn match  aflexMorePat    "\s*|\s*$"            skipnl    contained nextgroup=aflexPat,aflexPatTag,aflexPatComment
  52. syn match  aflexPatSep    "\s\+"                    contained nextgroup=aflexMorePat,aflexPatCode,aflexPatCodeLine
  53. syn match  aflexSlashQuote    +\(\\\\\)*\\"+                contained
  54. syn region aflexPatCode matchgroup=Delimiter start="{" matchgroup=Delimiter end="}"    skipnl contained contains=ALLBUT,@aflexListPatCodeGroup
  55.  
  56. syn keyword aflexCFunctions    BEGIN    input    unput    woutput    yyleng    yylook    yytext
  57. syn keyword aflexCFunctions    ECHO    output    winput    wunput    yyless    yymore    yywrap
  58.  
  59. " <c.vim> includes several ALLBUTs; these have to be treated so as to exclude aflex* groups
  60. syn cluster cParenGroup    add=aflex.*
  61. syn cluster cDefineGroup    add=aflex.*
  62. syn cluster cPreProcGroup    add=aflex.*
  63. syn cluster cMultiGroup    add=aflex.*
  64.  
  65. " Synchronization
  66. syn sync clear
  67. syn sync minlines=300
  68. syn sync match aflexSyncPat    grouphere  aflexPatBlock    "^%[a-zA-Z]"
  69. syn sync match aflexSyncPat    groupthere aflexPatBlock    "^<$"
  70. syn sync match aflexSyncPat    groupthere aflexPatBlock    "^%%$"
  71.  
  72. " Define the default highlighting.
  73. " For version 5.7 and earlier: only when not done already
  74. " For version 5.8 and later: only when an item doesn't have highlighting yet
  75.  
  76. if version >= 508 || !exists("did_aflex_syntax_inits")
  77.    if version < 508
  78.       let did_aflex_syntax_inits = 1
  79.       command -nargs=+ HiLink hi link <args>
  80.    else
  81.       command -nargs=+ HiLink hi def link <args>
  82.    endif
  83.   HiLink    aflexSlashQuote    aflexPat
  84.   HiLink    aflexBrace        aflexPat
  85.   HiLink aflexAbbrvComment    aflexPatComment
  86.  
  87.   HiLink    aflexAbbrv        SpecialChar
  88.   HiLink    aflexAbbrvRegExp    Macro
  89.   HiLink    aflexCFunctions    Function
  90.   HiLink    aflexMorePat    SpecialChar
  91.   HiLink    aflexPat        Function
  92.   HiLink    aflexPatComment    Comment
  93.   HiLink    aflexPatString    Function
  94.   HiLink    aflexPatTag        Special
  95.   HiLink    aflexSep        Delimiter
  96.   delcommand HiLink
  97. endif
  98.  
  99. let b:current_syntax = "aflex"
  100.  
  101. " vim:ts=10
  102.